<template>
  <div>
    <div class="banner" @click="handelShow">
      <img :src="banner.bannerImg" class="banner-img" />
      <div class="banner-info">
        <div class="banner-title">{{banner.sightName}}</div>
        <div class="banner-number">
          <span class="iconfont">&#xe609;</span>
          {{banner.gallaryImgs.length}}
        </div>
      </div>
    </div>
    <!-- fade组件是动画特效 -->
    <fade>
      <details-figure :imgList="banner.gallaryImgs" v-show="thisShow" @close="handelClose"></details-figure>
    </fade>
  </div>
</template>

<script>
import DetailsFigure from 'figure/DetailsFigure/DetailsFigure.vue'
import Fade from 'figure/fade/Fade.vue'
export default {
  name: 'Banner',
  components: {
    DetailsFigure,
    Fade
  },
  props: {
    banner: Object
  },
  data () {
    return {
      thisShow: false
    }
  },
  methods: {
    handelShow () {
      this.thisShow = true
    },
    handelClose () {
      this.thisShow = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/Mixins.styl'
  .banner
    position: relative
    overflow: hidden
    padding-bottom: 55%
    height: 0
    .banner-img
      width: 100%
    .banner-info
      position: absolute
      left: 0
      right: 0
      bottom: 0
      color: #fff
      height: .6rem
      display: flex
      background-image: linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.8))
      .banner-title
        flex: 1
        font-size: .32rem
        padding: 0 .2rem
        ellipsis()
      .banner-number
        line-height: .4rem
        height: .4rem
        border-radius: .2rem
        background: rgba(0,0,0,.8)
        font-size: .24rem
        padding: 0 .4rem
</style>
